package org.nepu.scr.indexrate.converter.riskrate.equipmentrisk;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentrisk.SafeB22c;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class SafeB22cConverter implements AttributeConverter<SafeB22c, String> {
    @Override
    public String convertToDatabaseColumn(SafeB22c safeB22c) {
        return JSONUtil.toJsonStr(safeB22c);
    }

    @Override
    public SafeB22c convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, SafeB22c.class);
    }
}
